// 不支持 Linux 系统
const pngquant = require("node-pngquant-native");
const fs = require("fs")

fs.readFile("./1.png", function (err, buffer) {
  if (err) {
    throw err
  }

  const retBuf = pngquant.compress(buffer, {
    "speed": 1 //1 ~ 11
  })

  fs.writeFile("1_new.png", retBuf)
})